#!/usr/bin/perl -w
# configure_billing.pm
# Copyright (C) 2006, 2007  Stephane Alnet
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
# 

#
# For more information: http://carrierclass.net/
#
use strict; use warnings;

package CCNCore::Provision::Application::Billing;
use base qw(CCNCore::Provision::Base);

uses_columns( qw( server.cdn_upstream_server ));

use CCNCore::Scripting;
use CCNCore::Home;

sub run()
{
    my $self = shift;
    return unless $self->p->count("server",{cdn_upstream_server => $self->p->server_pk}) > 0;
    
    COMMIT_MODULE(ref($self));
}

sub commit()
{
    CCNCore::Scripting::CRONTAB ('3 4 * * * '.CCNCore::Home::manager.'/lib/CCNCore/remote-billing.pl');   
}

1;